package com.wx.mall.user.controller;


import com.wx.mall.common.utils.DataResult;
import com.wx.mall.user.entity.TaskReward;
import com.wx.mall.user.service.ITaskRewardService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * <p>
 *  任务奖励设置前端控制器
 * </p>
 *
 * @author ljl
 * @since 2020-03-18
 */
@RestController
@RequestMapping("/task-reward")
@Api(tags = "任务奖励设置相关接口")
public class TaskRewardController {

    @Autowired
    private ITaskRewardService trs;

    @PostMapping("/updateTaskReward")
    @ApiOperation("更新任务奖励设置参数表")
    public DataResult initialGenerator(@ApiParam("任务奖励设置参数表")@Valid TaskReward taskReward) {
        trs.setTaskReward(taskReward);
        return DataResult.success();
    }

    @GetMapping("/getTaskReward")
    @ApiOperation("获取任务奖励设置参数表")
    public DataResult findById() {
        TaskReward taskReward = trs.getTaskReward();
        return DataResult.success(taskReward);
    }
}

